home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
EnigmA Amiga Run 1997 May
/
EnigmA AMIGA RUN 18 (1997)(G.R. Edizioni)(IT)[!][issue 1997-05][EAR-CD II].iso
/
softwareupdate
/
system
/
amigados
/
amigadoslibrary
/
write.c
< prev
next >
Wrap
C/C++ Source or Header
|
1996-10-10
|
923b
|
41 lines
/* Write.c V1.0 93-03-15 */
/* ROM library: "dos.library/Write", (All versions) */
/* Copyright 1993, Anders Bjerin, Amiga C Club */
#include <dos/dos.h>
#include <clib/dos_protos.h>
#include <stdio.h>
#include <stdlib.h>
UBYTE *version = "$VER: Write 1.0";
int main( int argc, char *argv[] );
int main( int argc, char *argv[] )
{
BPTR my_file;
int my_data[ 5 ] = { 1248, 2637, 842, 3721, 12 };
long bytes_written;
/* Open a new file: */
my_file = Open( "RAM:Score.dat", MODE_NEWFILE );
if( !my_file )
exit( 20 );
/* Write some data to the file: */
bytes_written = Write( my_file, my_data, sizeof( my_data ) );
/* Did we write all data? */
if( bytes_written != sizeof( my_data ) )
printf( "Error! Could not save all values!\n" );
else
printf( "All values were saved successfully!\n" );
/* Close the file: */
Close( my_file );
exit( 0 );
}